#!/usr/bin/env python
# -*- coding: utf-8 -*-

from urllib import urlretrieve, urlopen
import dbus
import msg


def notifique (title, text ):
	icon = '/usr/share/zaitan/pixmaps/zaitan64x64.png'
	#title = 'Programa Instalado'
	#text = 'Seu Programa já está instalado\nE pronta para usar!!!'
 
	bus = dbus.SessionBus()
	obj = bus.get_object('org.freedesktop.Notifications', '/org/freedesktop/Notifications')
	dbus_notify = dbus.Interface(obj, 'org.freedesktop.Notifications')
	dbus_notify.Notify("notify", 0, icon, title, text, "", {'x': 1200, 'y': 10}, 9000)



def new_zaitan():
	old = open('/usr/share/zaitan/zaitan.md5sum').read()
	new = urlopen('http://www.zaitan.net/package/zaitan.md5sum').read()
	if new != old:
		notifique(msg.msg3,msg.msg4)
